<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <div class="section">
                <h1>Usuário</h1>
                <h:form id="userForm" enctype="multipart/form-data">
                    <p:growl id="messages" life="3000" /> 
                    <div class="container_24 clearfix">
                        <h3 style="margin:0 0 10px 0">Dados Gerais</h3>
                        <p:outputLabel value="Nome : " styleClass="grid_3" for="nameInputText"/>
                        <p:inputText id="nameInputText" styleClass="grid_20" required="true"
                                     requiredMessage="Nome é obrigatório"
                                     value="#{managerCreateUser.user.name}" />
                        <p:outputLabel value="Cargo : " styleClass="grid_3" for="postInputText"/>
                        <p:inputText id="postInputText" styleClass="grid_20" 
                                     value="#{managerCreateUser.user.post}" />

                        <div class="clear" />
                        <h3 style="margin:0 0 10px 0">Login</h3>
                        <p:outputLabel value="Login : " styleClass="grid_3" for="loginInputText"/>
                        <p:inputText id="loginInputText" styleClass="grid_8" required="true"
                                     requiredMessage="Login é obrigatório"
                                     value="#{managerCreateUser.user.login}" />
                        <div style="clear: both" />
                        <p:outputLabel value="Senha : " styleClass="grid_3" for="passwordPassword"/>
                        <p:password id="passwordPassword" styleClass="grid_8" required="true"
                                    requiredMessage="Senha é obrigatório"
                                    value="#{managerCreateUser.user.password}" />
                        <p:outputLabel value="Confirmar Senha : " style="margin-left: -3px"
                                       styleClass="grid_4 alpha" for="confirmPassword"/>
                        <p:password id="confirmPassword" styleClass="grid_8" required="true"
                                    requiredMessage="Confirmar Senha é obrigatório"
                                    value="#{managerCreateUser.confirm}" />

                        <div class="clear" />
                        <h3 style="margin:0 0 10px 0">Nível de Acesso</h3>
                        <p:pickList id="pickList" value="#{managerCreateUser.dualGrupo}" var="g" 
                                    converter="groupconverter"
                                    itemLabel="#{g.name}" itemValue="#{g}" 
                                    showSourceFilter="true" showTargetFilter="true" 
                                    filterMatchMode="contains" style="width: 95%; margin-left: 30px">  
                            <f:attribute name="className" value="Groups" />

                            <f:facet name="sourceCaption">Disponíveis</f:facet>  
                            <f:facet name="targetCaption">Selecionados</f:facet>  

                        </p:pickList>
                        
                        <br/>
                        <div class="buttonAction">
                            <p:commandButton value="Salvar" icon="ui-icon-disk"
                                             update="@form" process="@form"
                                                actionListener="#{managerCreateUser.save()}"
                                                styleClass="ui-priority-primary" />
                            <p:button href="indexuser.xhtml" value="Cancelar"  icon="ui-icon-trash" />
                        </div >
                    </div>
                </h:form>
            </div>
        </ui:define>
    </ui:composition>

</html>
